/*
 * susi.cpp
 * susi is a Arduino communication library for communication with SUSI decoder modules
 * SUSI is a Trademark of DIETZ Modellbahntechnik www.d-i-e-t-z.de
 * Licensed for use under the terms of the GNU General Public License v3
 * V0.1 	MM 20.02.2013
 * 20.02.2013, Mark Martin, Munich, Germany
 * URC Project
 */

#ifndef SUSI_H
#define SUSI_H

#include "Arduino.h"

class susi {
  public:
    susi( unsigned char DT, unsigned char CK );
    ~susi();
    void begin();
    void end();
    void everyloop();
    inline boolean active();
    boolean sendCommand( byte adress, byte value );
    boolean sendF0F4( byte fkey );
    boolean sendF5F12( byte fkey );
    boolean sendVLOCO( byte vloco, boolean dir );
    boolean sendVCPU( byte vcpu, boolean dir );
    boolean sendLLOCO( byte lloco, boolean dir );
    boolean sendCV( unsigned int adress, byte value );
  private:
    unsigned char dtPin;
    unsigned char ckPin;
    boolean susiActiveFlag;
		byte susiActiveCounter;
    byte susiTxBuffer[ 3 ];
    byte susiTxBufferCounter;
};

#endif
